<?php 
$this->breadcrumbs()->addPage('Tramitação', 'entrada');
$this->breadcrumbs()->addPage('Cópias');
echo $this->breadcrumbs()->render(); 

echo $this->render('snippets/abasTramitacao.phtml');

echo $this->pagenav()->openList();

$html = '<div class="total_documents">Total de itens: <strong>' . $this->totalDocumentos . '</strong></div>';
echo $this->pagenav()->customHelperLinks($html);

echo $this->pagenav()->closeList();
?>

<div id="article">
    <form action="<?php echo $this->url(array('action' => 'pesquisar')) ?>" method="post">
        <fieldset class="search">
            <legend>Pesquisa</legend>
            <?php
            echo $this->fieldList()->open();
            echo $this->fieldList()->textbox('Número/Envolvido', 'q', $this->q);
            echo $this->fieldList()->close();
            
            echo $this->buttonlist()->open();
            echo $this->buttonlist()->button('Buscar');
            echo $this->buttonlist()->close(true);
            ?>
        </fieldset>
    </form>

     <?php if ($this->mostrar <> 'true'){ ?>

        <a href="<?php echo $this->url(array("action" => 'index','mostrar' => 'true'))  ?>"">Listar Processos</a>

    <?php } ?>

    <?php
    if ($this->mostrar == 'true') { ?>
	
    <form action="" method="post">
        <?php 
        echo $this->buttonlist()->open();
        echo $this->buttonlist()->defaultBlockActionsDescription();
        echo $this->buttonlist()->button('Excluir');
        echo $this->buttonlist()->close(true);
        ?>
        
        <table class="grid">
	        <thead>
	        	<tr>
	        		<th><input type="checkbox" id="checkbox_checkAll" /></th>
        			<th>Número</th>
        			<th>Data</th>
        			<th>Envolvido</th>
        			<th>Tipo</th>
        			<th>Assunto</th>
        			<th>Detalhes</th>
        		</tr>
        	</thead>
        	<tfoot>
        		<tr>
        			<td colspan="7"><?php echo $this->partial('pagination.phtml', array('paginator' => $this->paginator)) ?></td>
        		</tr>
        	</tfoot>
        	<tbody>
        		<?php $i = 0 ?>
        		<?php if (count($this->paginator) > 0): foreach ($this->paginator as $p): ?>
        		<tr class="<?php echo (++$i % 2) ? 'even' : 'odd' ?>">
        			<td><input type="checkbox" name="processos[]" value="<?php echo $p->id ?>" /></td>
        			<td><?php echo $p->processo->numero ?></td>
        			<td><?php echo $p->processo->data ?></td>
        			<td><?php echo $p->processo->nomeManifestante ?></td>
        			<td><?php echo $p->processo->nomeTipoProcesso ?></td>
        			<td><?php echo $p->processo->nomeAssunto ?></td>
        			<td>
        				<a href="<?php echo $this->url(array('action' => 'detalhes', 'controller' => 'processo', 'id' => $p->processo->id)) ?>">
        					Detalhes
        				</a>
        			</td>
        		</tr>
        		<?php endforeach; else: ?>
        		<tr>
        			<td colspan="8">Nenhuma cópia encontrada.</td>
        		</tr>
        		<?php endif ?>
        	</tbody>
        </table>
    </form>
        <?php    } ?>
</div>